<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>
<body>
    <div id="app">
        {{ computedAttr }}
    </div>
    <script>
        // 计算属性的完整写法
        const vm = new Vue({
            el:"#app",
            data:{
               myName:"yaoming"
            },
            computed:{
                computedAttr:{
                    get(){
                        // 必需有return
                        return this.myName[0].toUpperCase() + this.myName.substr(1)
                    },
                    set(val){
                        console.log(val);
                        this.myName = val
                    }
                }
            }
        })

    </script>
</body>
</html>